package test;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class test {
    public static void main(String[] args) {
        JFrame jFrame = new JFrame();
        //设置游戏窗口的宽高
        jFrame.setSize(603,680);
        //设置标题
        jFrame.setTitle("拼图小游戏单机版");
        //总是置顶
        jFrame.setAlwaysOnTop(true);
        //设置居中
        jFrame.setLocationRelativeTo(null);
        //设置默认关闭方式
        JButton jButton = new JButton("请点击");
        jButton.setBounds(0,0,100,50);
        jButton.addActionListener(new ActionListener() {
            //匿名内部类
            @Override
            public void actionPerformed(ActionEvent e) {
                System.out.println("按钮被点击了");
            }
        });
        jFrame.getContentPane().add(jButton);




        jFrame.setDefaultCloseOperation(3);
        jFrame.setLayout(null);
        jFrame.setVisible(true);
    }
}
